package com.itheima.mapper;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.itheima.dto.NewsDto;
import com.itheima.entity.News;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.itheima.vo.NewsVo;
import com.itheima.vo.news.NewsLastVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.time.LocalDateTime;
import java.util.List;

/**
 * @author 51585
 * @description 针对表【news】的数据库操作Mapper
 * @createDate 2022-10-26 09:55:02
 * @Entity com.itheima.entity.News
 */
@Mapper
public interface NewsMapper extends BaseMapper<News> {
    /**
     * 查看历史消息3条
     *
     * @param sendUserId
     * @param acceptUserId
     * @return
     */
    List<LocalDateTime> checkHistory(@Param("sendUserId") String sendUserId, @Param("acceptUserId") String acceptUserId);

    /**
     * 查看历史聊天记录20条
     *
     * @param userId
     * @param bUserId
     * @return
     */
    List<NewsVo> showRecentNews(@Param("userId") String userId, @Param("bUserId") String bUserId);

    /**
     * 分页查看历史聊天记录
     *
     * @param page
     * @param newsDto
     * @param bUserId
     * @return
     */
    IPage<NewsVo> pageNews(@Param("page") Page page, @Param("newsDto") NewsDto newsDto, @Param("bUserId") String bUserId);

    /**
     * 最新聊天内容
     * @param sendUserId
     * @param acceptUserId
     * @return
     */
    NewsLastVo findLast(@Param("sendUserId") String sendUserId, @Param("acceptUserId") String acceptUserId);
}




